package com.xy.tx;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/4/9 16:14
 * @description
 */

@Repository
public class UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Transactional
    public void insert(String name) {
        String sql = "INSERT INTO t_test(`name`) VALUES(?)";
        jdbcTemplate.update(sql,name);
        int i = 1 / 0;
    }
}
